package org.millioncall.yueyoga.admin.service;

import java.util.List;
import java.util.Map;

import org.millioncall.openplatform.common.PaginatedList;
import org.millioncall.yueyoga.admin.model.AviatorExpression;
import org.millioncall.yueyoga.admin.model.HomePageTaskRecord;
import org.millioncall.yueyoga.admin.model.Task;

public interface TaskService {
	public boolean save(Task task);

	public boolean update(Task task);

	public boolean deleteById(Integer taskId);

	public boolean deleteByIds(String[] ids);

	public Task findTaskById(Map<String, Object> map);

	public Task findTaskRelatedInfoById(Map<String, Object> map);

	/** 条件分页查询 **/
	public PaginatedList<Task> findTasksInPage(Map<String, Object> map,
			int start, int limit);

	public List<Task> findTaskLimit();

	/**
	 * 查询主页的任务列表
	 * 
	 * @param map
	 * @param start
	 * @param limit
	 * @return
	 */
	public PaginatedList<HomePageTaskRecord> findHomeTasksInPage(
			Map<String, Object> map, int start, int limit);

	/** 查询任务数量 **/
	public int findExpiredTaskCount(Map<String, Object> map);

	/*** 任务条件查询 */
	public PaginatedList<HomePageTaskRecord> findTasksByCdts(
			Map<String, Object> map, int start, int limit);

	/*** 根据任务状态查询任务 */
	public PaginatedList<HomePageTaskRecord> findTasksByState(
			Map<String, Object> map, int start, int limit);
	
	/**
	 * 查询所有符合aviator表达式的任务
	 * 
	 * @param expression
	 * @param params
	 * @param start
	 * @param limit
	 * @return
	 */
	public List<HomePageTaskRecord> getAllTasksWithAviator(Map<String, Object> params,
			AviatorExpression expression, Map<String, Object> aviatorParams,
			int limit);
}
